﻿package mortal.game.view.guide.guideUse
{
    import com.gengine.global.*;
    import com.gengine.keyBoard.*;
    import com.mui.utils.*;
    import mortal.common.swfPlayer.*;
    import mortal.common.swfPlayer.data.*;
    import mortal.game.manager.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class GuidePlayerRollingView extends GuideUseSkillBase
    {
        private var _bg:SWFPlayer;
        private var _swf:SWFPlayer;

        public function GuidePlayerRollingView()
        {
            super.layer = LayerManager.windowLayer;
            return;
        }// end function

        override public function show(param1:int = 0, param2:int = 0) : void
        {
            super.show(param1, param2);
            this.x = Global.stage.stageWidth / 2 + 100;
            this.y = Global.stage.stageHeight / 2 + 240;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UICompomentPool.getUICompoment(SWFPlayer);
            this._bg.timeRate = 3;
            this._bg.load(ImagesConst.GuideUseBg + ".swf", ModelType.NormalSwf, null);
            this._bg.move(-94, 70);
            this.addChild(this._bg);
            this._swf = UICompomentPool.getUICompoment(SWFPlayer);
            this._swf.timeRate = 3;
            this._swf.load("guideUseSpace.swf", ModelType.NormalSwf, null);
            this.addChild(this._swf);
            KeyBoardManager.instance.addEventListener(KeyEvent.KEY_DOWN, this.onKeyDownHandler);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._bg.dispose(param1);
            this._bg = null;
            this._swf.dispose(true);
            this._swf = null;
            KeyBoardManager.instance.removeEventListener(KeyEvent.KEY_DOWN, this.onKeyDownHandler);
            return;
        }// end function

        private function onKeyDownHandler(event:KeyEvent) : void
        {
            if (event == null || event.keyData == null || event.keyData.keyMap == null)
            {
                return;
            }
            if (event.keyData.keyMap.key == ModuleType.SPACE)
            {
                this.hide();
            }
            return;
        }// end function

    }
}
